<h2>Danh sách sản phẩm</h2>

<form name="" id="" action="<?php echo URL_BASE . '/admin/product/delProducts'; ?>" method="post" >
    <input type="submit" name="btnDel" value="Xóa mục đã chọn" style="background: #fff; border: none; cursor: pointer;" />
    <table class="employees" border="0">
        <tr>
            <th><input type="checkbox" name="" id="checkAll" onclick="doCheckAll();" value="" /></th>
            <th>ID</th>
            <th>Name</th>
            <th>Category</th>
            <th>Thumb</th>
            <th>PRICE</th>
            <th>POST DATE</th>
            <th>Status</th>
            <th>Images</th>
            <th>Sale</th>
            <th>Action</th>
        </tr>
        <?php
        $pro = new Admin_Models_Product();
        $cat = new Admin_Models_Category();
        $rows = $this->listPro;
        $url = $db->getCurrentUrl();
        $objPaging = new Libs_Paging($url, $rows, 5);
        $rows = $objPaging->getRecords();
        foreach ($rows as $pro) {
            ?>
            <tr class="emp">
                <td class="cell"><input type="checkbox" name="checkOne[]" value="<?php echo $pro->getProId(); ?>" /></td>
                <td class="cell"><?php echo $pro->getProId(); ?></td>
                <td class="cell"><?php echo $pro->getName(); ?></td>
                <td class="cell">
                    <?php
                    foreach ($cat->getParentCat() as $c) {
                        if ($c->getCatId() == $pro->getCatId())
                            echo $c->getName();
                        foreach ($cat->getChildCat($c->getCatId()) as $cc) {
                            if ($cc->getCatId() == $pro->getCatId())
                                echo $cc->getName();
                        }
                    }
                    ?>
                </td>
                <td class="cell"><img src="<?php echo URL_BASE . DS . $pro->getThumb(); ?>" style="width: 70px; height: 40px;" /></td>
                <td class="cell"><?php echo number_format($pro->getPrice(), 0, ',', '.'); ?></td>
                <td class="cell"><?php echo date('d/m/Y', strtotime($pro->getPostDate())); ?></td>
                <td class="cell"><?php echo $pro->getStatus() == 0 ? "Hết hàng" : "Còn hàng"; ?></td>
                <td class="cell"><a href="<?php echo URL_BASE . '/admin/product/proImages/' . $pro->getProId(); ?>">Xem</a></td>
                <td class="cell"><a href="<?php echo URL_BASE . '/admin/product/proSales/' . $pro->getProId(); ?>">Xem</a></td>
                <td class="cell"><a href="<?php echo URL_BASE . '/admin/product/editForm/' . $pro->getProId(); ?>">Sửa</a> / <a href="<?php echo URL_BASE . '/admin/product/delPro/' . $pro->getProId(); ?>" onclick="if (confirm('Bạn có chắc chắn muốn xóa không?'))
                            return true;
                        else
                            return false;">Xóa</a></td>
            </tr>
            <?php
        }
        ?>
    </table>
</form>

<?php
echo $objPaging->getPaging();
?>